#include <stdio.h>

int sum(int *start, int *end) {
  int result = 0;
  while (start < end) {
    result += *start++;
  }
  return result;
}

int main() {
  int arr[5] = {1, 2, 3, 4, 5};
  int result = sum(arr, arr + 5);
  printf("%d", result);
}